<?
	function getConnection()
{
	
	$conn = new mysqli('localhost', 'plotkinm','FaceBooK' , 'plotkinm_db');
	
	if ($conn->error)
	{
		throw new Exceprion($conn->error, 1);
	}
	
	return $conn;
	
}

function getCities($string)
{
	$conn = getConnection();
	$data = $conn->query("Select DISTINCT city From US_Zip_Codes Where city like '$string%' Limit 100");
	
	echo $conn->error;
	
	$conn->close();
		
	return $data;
}

function getStates($string)
{
	$conn = getConnection();
	$data = $conn->query("Select DISTINCT state From US_Zip_Codes Where state like '$string%' Limit 100");
	
	echo $conn->error;
		
	$conn->close();
	
	return $data;
}

	

	
